import { ImagesConst } from "../../../resource/ImagesConst";
import { ObjCreate } from "../../common/ObjCreate";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
//class GuildActivityRecommendPanel
    
    export  class GuildActivityRecommendPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._labelArray = [ImagesConst.itemText, ImagesConst.expText, ImagesConst.copperText, ImagesConst.AuraText, ImagesConst.ContributionText];
            this._starBitmapArray = [];
            return;
        }

        /* internal  */init(): void
        {
            var loc1=null;
            var loc3=null;
            var loc2=0;
            while (loc2 < this._labelArray.length) 
            {
                loc1 = this._labelArray[loc2] as string;
                ObjCreate.createBitmap(loc1, 0, 0 + loc2 * 20, this);
                ++loc2;
            }
            var loc4=0;
            while (loc4 < 25) 
            {
                loc3 = ObjCreate.createBitmap(ImagesConst.DailyStar1, 30 + loc4 % 5 * 13, 0 + Math.floor(loc4 / 5) * 20, this);
                this._starBitmapArray.push(loc3);
                ++loc4;
            }
            return;
        }

        public updateByRecommend(arg1: Array<any>): void
        {
            this._recommends = arg1;
            if (this._isLoader) 
            {
                this.update();
            }
            else 
            {
                LoaderHelp.addResCallBack(ResFileConst.daily, this.onDailyResLoadedHandler);
            }
            return;
        }

        /* internal  */update(): void
        {
            var loc2=0;
            var loc3=0;
            var loc4=0;
            var loc5=0;
            var loc6=null;
            var loc8=0;
            var loc1=this._recommends;
            var loc7=0;
            while (loc7 < loc1.length) 
            {
                loc2 = int(loc1[loc7]);
                loc5 = (loc4 = loc7 * 5) + 5;
                loc3 = loc4 + loc2;
                loc8 = loc4;
                while (loc8 < loc5) 
                {
                    loc6 = this._starBitmapArray[loc8] as Object /* flash.display.Bitmap */;
                    if (loc8 < loc3) 
                    {
                        loc6.bitmapData = GlobalClass.getBitmapData(ImagesConst.DailyStar);
                    }
                    else 
                    {
                        loc6.bitmapData = GlobalClass.getBitmapData(ImagesConst.DailyStar1);
                    }
                    ++loc8;
                }
                ++loc7;
            }
            return;
        }

        /* internal  */onDailyResLoadedHandler(): void
        {
            this._isLoader = true;
            this.init();
            this.update();
            return;
        }

        /* internal */ /* var */_labelArray: Array<any>;

        /* internal */ /* var */_starBitmapArray: Array<any>;

        /* internal */ /* var */_recommends: Array<any>;

        /* internal */ /* var */_isLoader: Boolean;
    }
